﻿Imports System.Data.OleDb

Public Class Detail
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_AddComment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_AddComment.Click
        Dim Sql As String = "Insert into Comments (Author,Title,CommentBody,Event_fkID) Values (@f1,@f2,@f3,@f4)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("MysteryEventConnectionString").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(Sql, conn)

        cmd.Parameters.AddWithValue("@f1", tb_UserName.Text)
        cmd.Parameters.AddWithValue("@f1", tb_Title.Text)
        cmd.Parameters.AddWithValue("@f1", tb_CommentBody.Text)
        cmd.Parameters.AddWithValue("@f4", Request.QueryString("ID"))

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("Detail.aspx?ID=" & Request.QueryString("ID"))
    End Sub
End Class